package com.atguigu.eduservice.feign;

import com.atguigu.commonutils.R;
import com.atguigu.eduservice.feign.impl.VodFileDegradeFeignClient;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @ClassName VodClient
 * @Description TODO
 * @Detail 熔断器整合
 *              1、导入hystrix依赖
 *              2、在配置文件中开启熔断机制
 *              3、添加远程调用接口的实现类，实现接口方法
 *                  1、远程调用失败会执行实现后的接口方法，如被调用方服务器挂了，那么它就会执行实现后的接口方法
 *              4、在远程调用接口指定远程调用接口实现类
 * @Author MyPC
 * @Date 2020/6/23
 * @Version 1.0
 */
@FeignClient(name = "service-vod",fallback = VodFileDegradeFeignClient.class)
@Component
public interface VodClient {
    /**
     * 注意事项：
     *      1、@PathVariable()要指定参数名，否则远程调用会出错
     * @param videoId
     * @return
     */
    @DeleteMapping("/eduvod/video/removeAlyVideo/{videoId}")
    public R removeAlyVideo(@PathVariable("videoId") String videoId);

    @DeleteMapping("/eduvod/video/deleteBatch")
    public R deleteBatch(@RequestParam("videoIds") List<String> videoIds);
}
